package xrz.cuanbao.adapters;

import java.io.IOException;

import org.xutils.common.util.LogUtil;

import android.content.Context;
import android.content.res.AssetManager;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

public class EmojAdapter extends BaseAdapter {
	private String[] emojs;
	private Context context;

	public EmojAdapter(Context context) {
		this.context = context;
		searchEmoj();
	}

	private void searchEmoj() {
		AssetManager assetManager = context.getAssets();
		try {
			emojs = assetManager.list("emoj");
		} catch (IOException e) {
		}
	}

	public void log(){
		if (emojs == null){
			LogUtil.e("==================");
			return;
		}
		for(String s : emojs){
			LogUtil.e(s);
		}
	}
	@Override
	public int getCount() {
		if (emojs == null)
			return 0;
		return emojs.length;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ImageView imageView;
		if (convertView == null) {
			imageView = new ImageView(context);
			convertView = imageView;
		}else{
			imageView = (ImageView) convertView;
		}
		return convertView;
	}

}
